<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    const obj ={
        name:'张三',
        family:{
            father:'李四'
        },
        hobby:["琴棋书画"],
    }
    console.log(obj)
    function cloneDeep(oldobj){
       const newobj = Array.isArray(oldobj)?[]:{}
        for(let k in oldobj){
            if(typeof oldobj[k]=== 'object')
                newobj[k] = cloneDeep(oldobj[k])
            else {
                newobj[k] = oldobj[k]
            }
        }
        return newobj
    }
    const newobj = cloneDeep(obj)
    newobj.family.father = '王五'
    console.log(newobj)

    var xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function (){
        if (xhr.readyState ==4){
            if (xhr.status == 200){
                alert(xhr.responseText)
            }
        }
    }
    xhr.open('GET','')
    xhr.send(null)



    new Promise((resolve, reject)=>{
        setTimeout(()=>{
            resolve(1)
        })
    }).then(value => {
        console.log('value'.value)
    }),reason =>{
        console.log('reason',reason)
    }
</script>
</body>
</html>